﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace RescueRaiders
{
    namespace Particles
    {
        class DustParticleSystem : ParticleSystem
        {
            public DustParticleSystem(Game1 game,
                int howManyEffects, string textureFileName) :
                base(game, howManyEffects, textureFileName)
            {
            }

            protected override void InitializeConstats()
            {

                minInitialSpeed = 20;
                maxInitialSpeed = 100;

                minAcceleration = -4;
                maxAcceleration = -10;

                minLifeTime = 0.5f;
                maxLifeTime = 2.0f;

                minScale = 0.1f;
                maxScale = 0.02f;

                minNumParticles = 15;
                maxNumParticles = 25;

                minRotationSpeed = -2f * MathHelper.Pi;
                maxRotationSpeed = -MathHelper.Pi;

                spriteBlendMode = SpriteBlendMode.AlphaBlend;

                DrawOrder = AlphaBlendDrawOrder;


            }

            /// <summary>
            /// PickRandomDirection is overriden so that we can make the particles always 
            /// move have an initial velocity pointing up.
            /// </summary>
            /// <returns>a random direction which points basically up.</returns>
            protected override Vector2 PickRandomDirection()
            {
                // Point the particles somewhere between 80 and 100 degrees.
                // tweak this to make the smoke have more or less spread.
                float radians = ParticleSystem.RandomBetween(
                    MathHelper.ToRadians(0), MathHelper.ToRadians(30));

                Vector2 direction = Vector2.Zero;
                // from the unit circle, cosine is the x coordinate and sine is the
                // y coordinate. We're negating y because on the screen increasing y moves
                // down the monitor.
                direction.X = (float)Math.Cos(radians);
                direction.Y = -(float)Math.Sin(radians);
                return direction;
            }
        }
    }
}



